package com.bdsoft.security.mapper;

import com.bdsoft.security.entity.OperationLogDTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface PermisstionMapper {
    @Select("SELECT resource_id FROM resource WHERE url = #{url} AND method = #{method}")
    String getResourceIdByUrlAndMethod(@Param("url") String url, @Param("method") String method);
    @Select("SELECT * FROM resource WHERE url = #{url} AND method = #{method}")
    Map<String,Object> getResourceByUrlAndMethod(@Param("url") String url, @Param("method") String method);


    @Insert("insert into operationlog(log_id, user_id, operation, method, ip, params, create_time) " +
            "values(#{logId}, #{userId}, #{operation}, #{method}, #{ip}, #{params}, #{createTime})")
    int InsertLog(OperationLogDTO operationLogDTO);
} 